<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="\static\layui\css\layui.css" media="all" />
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=xQt4pzigo12tg6EEryGZmZBB9ul6KKCx"></script>
    <style>
        form{
            margin:30px;
        }
    </style>
</head>
{extend name='admin@public/content'}
{block name="button"}
<a data-open='{:url("$classuri/add")}' class='layui-btn layui-btn-sm layui-btn-primary'>添加店铺</a>
{/block}
{block name="content"}
<!-- 表单搜索 开始 -->

<form autocomplete="off" class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">
    <div class="layui-form-item layui-inline">
        <div class="layui-input-inline">
            <input name="username" value="{$Think.get.username|default=''}" placeholder="输入账号/店铺名称/查找" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <div class="layui-input-inline">
            <select name="status" class="layui-select">
                <option value="">状态</option>
                {foreach($list['status'] as $k=>$v)}
                {if $Think.get.status eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <div class="layui-input-inline">
            <select name="role" class="layui-select layui-inline">
                <option value="">流水类型</option>
                {foreach($list['type'] as $k=>$v)}
                {if $Think.get.role eq $v.id}
                <option selected="selected" value="{$v.id}">{$v.name}</option>
                {else}
                <option value="{$v.id}">{$v.name}</option>
                {/if}
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline" >
        <div class="layui-input-inline">
            <div class="layui-input-inline" >
                <select name="province" id="province"  lay-filter="myselect">
                    <option value="">所在省份</option>
                    {foreach($list['area'] as $k=>$v)}
                    {if $Think.get.province eq $v.ID}
                    <option selected="selected" value="{$v.ID}">{$v.ShortName}</option>
                    {else}
                    <option value="{$v.ID}">{$v.ShortName}</option>
                    {/if}
                    {/foreach}
                </select>
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-inline" >
        <div class="layui-input-inline">
            <div class="layui-input-inline">
                <select name="City" id="City" lay-filter="myselect2" >
                    <option value="">所在地区</option>
                </select>
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-inline" >
        <div class="layui-input-inline">
            <div class="layui-input-inline">
                <select name="Area" id="Area" lay-filter="myselect3">
                    <option value="">所在区域</option>

                                </select>
            </div>
        </div>
    </div>


    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>
</form>
<script>
    window.laydate.render({range: true, elem: '#range-date'});
</script>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    <!--{empty name='list'}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='text-left nowrap'>店铺名称 </th>
            <th class='text-left nowrap'>店铺账户</th>
            <th class='text-left nowrap'>绑定手机号</th>
            <th class='text-left nowrap'>所属省份</th>
            <th class='text-left nowrap'>店铺类型</th>
            <th class='text-left nowrap'>注册时间</th>
            <th class='text-left nowrap'>状态</th>
            <th class='text-left nowrap'></th>
        </tr>
        </thead>

        <tbody>
        {foreach($list['list'] as $key=>$value)}
        <tr>
            <td class='text-left nowrap'>
                {$value.name|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.username|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.bind_mobile|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.province|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.typeName|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.updated_at|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                <?php if($value['status'] ==1 ){?>
                <a class="typeedit menu-item-deleted layui-btn layui-btn-sm  layui-btn-normal" data-id="{$value.id}" >{$value.statusName|default='暂无'}</a>
                <?php }else if($value['status'] ===0){?>
                <a class=" typeedit menu-item-deleted layui-btn layui-btn-sm layui-btn-warm " data-id="{$value.id}" >{$value.statusName|default='暂无'}</a>
                <?php }else{?>
                <a class=" typeedit menu-item-deleted layui-btn layui-btn-sm layui-btn-danger " data-id="{$value.id}">{$value.statusName|default='暂无'}</a>
                <?php }?>
            </td>
            <td class='text-center nowrap'>
                <span class="text-explode">|</span>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("$classuri/edit")}?id={$value.id}'><i class="layui-icon layui-icon-edit"></i>编辑</a>
                <span  class="text-explode">|</span>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("$classuri/shopService")}?id={$value.id}'>服务列表</a>
                <span class="text-explode">|</span>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("admin/adminorder/index")}?shop={$value.name}'>订单明细</a>
                <span class="text-explode">|</span>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("admin/admincapital/business")}?shopid={$value.id}'>收入流水</a>
                <span class="text-explode">|</span>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("admin/adminshop/shopProfit")}?id={$value.id}'>商家收益</a>
                <span class="text-explode">|</span>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("$classuri/shopCapital")}?id={$value.id}'>提现记录</a>
                <span class="text-explode">|</span>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-update="{$value.id}" data-field='delete' data-action='{:url("$classuri/delShop")}?id={$value.id}'>删除</a>
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($list.page)}<p>{$list.page|raw}</p>{/if}
    <!--{/empty}-->
</form>
{/block}
<script charset="UTF-8" src="\static\layui\layui.js"></script>
{block name="script"}
<!--表单初始化-->
<script>
        layui.use(['layer', 'form'], function(){
            var layer = layui.layer
                ,form = layui.form;
            form.on('select(myselect)', function(data){
                var areaId = (data.value);
                $.ajax({
                    type: 'get',
                    url: '/admin/Adminshop/getarea',
                    data: {pid:areaId},
                    dataType:  'json',
                    success: function(data){
                        $("#City").html("");
                        $.each(data, function(key, val) {
                            var option1 = $("<option>").val(val.ID).text(val.ShortName);
                            $("#City").append(option1);
                            form.render('select');
                        });
                        $("#City").get(0).selectedIndex=0;
                    }
                });
            });
            form.on('select(myselect2)', function(data){
                var areaId = (data.value);
                $.ajax({
                    type: 'get',
                    url: '/admin/Adminshop/getarea',
                    data: {pid:areaId},
                    dataType:  'json',
                    success: function(data){
                        $("#Area").html("");
                        $.each(data, function(key, val) {
                            var option1 = $("<option>").val(val.ID).text(val.ShortName);
                            $("#Area").append(option1);
                            form.render('select');
                        });
                        $("#Area").get(0).selectedIndex=0;
                    }
                });
            });
        });

    window.laydate.render({range: true, elem: '#create_at'});
    window.form.render();
   $('.typeedit').on('click',function () {
       var id = $(this).data('id');
       var dialogIndex = $.msg.confirm('请谨慎操作？', function (){
           $.msg.close(dialogIndex);
           $.ajax({
               url:'admin/adminshop/edittype',
               type:'GET',
               data:{id:id,'type':1},
               success:function(data){
                   console.log(data);
                    window.location.reload()
               }
           })
       });
   });

</script>
<!--引入标签设置-->
{/block}